﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Principal;
using System.Diagnostics;
using System.Threading;
using System.Web;

namespace Hop.Hop.Common
{
    public static class WhoAmI
    {
        public static void TraceWhoIAm(string category)
        {
            traceMethod("WindowsIdentity.GetCurrent().Name", WindowsIdentity.GetCurrent().Name, category);
            traceMethod("Thread.CurrentPrincipal.Identity.Name", Thread.CurrentPrincipal.Identity.Name, category);
            traceMethod("HttpContext.Current.User.Identity.Name ", HttpContext.Current.User.Identity.Name, category);
            
        }

        static void traceMethod(string method, string result, string category)
        {
            Trace.WriteLine(string.Format("{0,-41} : {1,-18}",method,result ), category);
        }
    }
}
